Find and replace the appearance of the substring

Find the first appearance of the substring ‘not’ and ‘poor’
from a given string.
If ‘not’ follows the ‘poor’, replace the whole ‘not’…’poor’
substring with ‘good’.
Return the resulting string.
Sample String :
‘The lyrics is not that poor!’
‘The lyrics is poor!’
Expected Result :
‘The lyrics is good!’
‘The lyrics is poor!’
def not_poor(S):
    not_idx  = S.find('not')
    poor_idx = S.find('poor')

    if poor_idx > not_idx and
       not_idx > 0 and
       poor_idx > 0:
        S = S.replace(S[not_idx:(poor_idx + 4)], 'good')
        return S
    else:
        return S

# test
print(not_poor('The lyrics is not that poor!'))  # The lyrics is good!
print(not_poor('The lyrics is poor!'))           # The lyrics is poor!